//Sat Jul  2 20:32:01 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class Zoo {
public:
	long long theCount(vector <int>);
	map<int, int> mp;
};

long long Zoo::theCount(vector <int> ans) {
	int N = ans.size();
	sort(ans.begin(), ans.end());
	for(int i=0; i<N; i++){
		mp[ans[i]]++;
		if(mp[ans[i]] > 2) return 0;
	}
	for(int i=0; i<=40; i++){
		if(mp[i] < mp[i+1]) return 0;
	}
	int ones = 0;
	int twos = 0;
	for(int i=0; i<=40; i++){
		if(mp[i]==1) ones++;
		else if(mp[i]==2) twos++;
	}
	long long ret = 1;
	for(int i=0; i<twos; i++) ret *= 2;
	if(ones > 0) ret *= 2;
	return ret;
}

//Powered by [KawigiEdit] 2.0!
